package com.smart.dao;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import com.smart.common.dao.AbstractDao;
import com.smart.domain.Login;
import com.smart.tools.ObjectHelper;

/**
 * 
 * 版权所有：xxxxxxx
 * @Description: 登录
 * @Title: LoginDao.java 
 * @ClassName: LoginDao 
 * @author tangyan 
 * @date 2019年2月13日 下午6:25:38 
 * @version V1.0
 */
@Repository
@Transactional
public class LoginDao  extends AbstractDao<Login>{

	/**
	 * 
	 * @Title: queryUser 
	 * @Description: 查询登录信息
	 * @author tangyan 
	 * @param conditions
	 * @return
	 */
	public List<Login> queryLogin(Map<String, Object> conditions){
		StringBuffer hql = new 	StringBuffer(" from Login l  where l.isDeleted = 0 ");
		if(ObjectHelper.isNotEmpty(conditions.get("userId"))){
			hql.append(" and l.userId = :userId ");
		}
		
		if(ObjectHelper.isNotEmpty(conditions.get("token"))){
			hql.append(" and l.token = :token ");
		}
		
		return this.findByHql(hql.toString(), conditions);
	}


}
